#include <iostream>
#include <math.h>
using namespace std;


class Point
{
    public:
    Point(int x,int y)
    :_ix(x)
    ,_iy(y)
    {}

    void print()  const
    {
        cout << "("<< _ix << "," << _iy << ")" <<endl;  
    }

    //声明Line类为Point的友元类
    friend class Line;
    private:
    int _ix;
    int _iy;
};

class Line
{
    public:
    float destance(const Point &lhs,const Point &rhs);
    void setx(Point & rhs,int x)
    {
        rhs._ix = x;
    }
};

float Line::destance(const Point &lhs,const Point &rhs)
{
    return sqrt(pow(lhs._ix - rhs._ix ,2)
                +pow(lhs._iy - rhs._iy,2));
}

void test0()
{
    Point pt(0,0);
    Point pt2(3,4);
    Line l;
    cout <<l.destance(pt,pt2) << endl;

    l.setx(pt,3);
    pt.print();
}
int main()
{
    test0();
    return 0;
}